home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / gui / x / twm93053.lha / twm / gc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-29  |  3.9 KB  |  94 lines

  1. /*****************************************************************************/
  2. /**       Copyright 1988 by Evans & Sutherland Computer Corporation,        **/
  3. /**                          Salt Lake City, Utah                           **/
  4. /**  Portions Copyright 1989 by the Massachusetts Institute of Technology   **/
  5. /**                        Cambridge, Massachusetts                         **/
  6. /**                                                                         **/
  7. /**                           All Rights Reserved                           **/
  8. /**                                                                         **/
  9. /**    Permission to use, copy, modify, and distribute this software and    **/
  10. /**    its documentation  for  any  purpose  and  without  fee is hereby    **/
  11. /**    granted, provided that the above copyright notice appear  in  all    **/
  12. /**    copies and that both  that  copyright  notice  and  this  permis-    **/
  13. /**    sion  notice appear in supporting  documentation,  and  that  the    **/
  14. /**    names of Evans & Sutherland and M.I.T. not be used in advertising    **/
  15. /**    in publicity pertaining to distribution of the  software  without    **/
  16. /**    specific, written prior permission.                                  **/
  17. /**                                                                         **/
  18. /**    EVANS & SUTHERLAND AND M.I.T. DISCLAIM ALL WARRANTIES WITH REGARD    **/
  19. /**    TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES  OF  MERCHANT-    **/
  20. /**    ABILITY  AND  FITNESS,  IN  NO  EVENT SHALL EVANS & SUTHERLAND OR    **/
  21. /**    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL  DAM-    **/
  22. /**    AGES OR  ANY DAMAGES WHATSOEVER  RESULTING FROM LOSS OF USE, DATA    **/
  23. /**    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER    **/
  24. /**    TORTIOUS ACTION, ARISING OUT OF OR IN  CONNECTION  WITH  THE  USE    **/
  25. /**    OR PERFORMANCE OF THIS SOFTWARE.                                     **/
  26. /*****************************************************************************/
  27.  
  28.  
  29. /**********************************************************************
  30.  *
  31.  * $XConsortium: gc.c,v 1.22 91/01/09 17:13:12 rws Exp $
  32.  *
  33.  * Open the fonts and create the GCs
  34.  *
  35.  * 31-Mar-88 Tom LaStrange        Initial Version.
  36.  *
  37.  **********************************************************************/
  38.  
  39. #include <stdio.h>
  40. #include "twm.h"
  41. #include "util.h"
  42. #include "screen.h"
  43.  
  44. /***********************************************************************
  45.  *
  46.  *  Procedure:
  47.  *    CreateGCs - open fonts and create all the needed GC's.  I only
  48.  *            want to do this once, hence the first_time flag.
  49.  *
  50.  ***********************************************************************
  51.  */
  52.  
  53. void
  54. CreateGCs()
  55. {
  56.     static ScreenInfo *prevScr = NULL;
  57.     XGCValues        gcv;
  58.     unsigned long   gcm;
  59.  
  60.     if (!Scr->FirstTime || prevScr == Scr)
  61.     return;
  62.  
  63.     prevScr = Scr;
  64.  
  65.     /* create GC's */
  66.  
  67.     gcm = 0;
  68.     gcm |= GCFunction;        gcv.function = GXxor;
  69.     gcm |= GCLineWidth;        gcv.line_width = 0;
  70.     gcm |= GCForeground;    gcv.foreground = Scr->XORvalue;
  71.     gcm |= GCSubwindowMode; gcv.subwindow_mode = IncludeInferiors;
  72.  
  73.     Scr->DrawGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
  74.  
  75.     gcm = 0;
  76.     gcm |= GCForeground;    gcv.foreground = Scr->MenuC.fore;
  77.     gcm |= GCBackground;    gcv.background = Scr->MenuC.back;
  78.     gcm |= GCFont;        gcv.font =  Scr->MenuFont.font->fid;
  79.  
  80.     Scr->MenuGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
  81.  
  82.     gcm = 0;
  83.     gcm |= GCPlaneMask;        gcv.plane_mask = AllPlanes;
  84.     /*
  85.      * Prevent GraphicsExpose and NoExpose events.  We'd only get NoExpose
  86.      * events anyway;  they cause BadWindow errors from XGetWindowAttributes
  87.      * call in FindScreenInfo (events.c) (since drawable is a pixmap).
  88.      */
  89.     gcm |= GCGraphicsExposures;  gcv.graphics_exposures = False;
  90.     gcm |= GCLineWidth;        gcv.line_width = 0;
  91.  
  92.     Scr->NormalGC = XCreateGC(dpy, Scr->Root, gcm, &gcv);
  93. }
  94.